import requests
import json

# r = requests.get('http://127.0.0.1:8000/api/get_event_list/?eid=1')
# result = r.json()
# print(result)
# print(result['data']['name'])
# print(r.text)
# print(r.content)
# r = requests.get('http://woniuxy.com/11111111')
# print(r.status_code)
# print(r.encoding)
# r.encoding = 'utf-8'
# # print(r.cookies['PHPSESSID'])
# # print(r.headers)
# # print(r.url)
# print(r.text)
# print(r.content)
# print(r.json())
# print(r.cookies)

# r = requests.get('http://localhost/agileone/index.php')
# print(r.status_code)
# print(r.url)
# # print(r.text)
# print(r.encoding)   #查看编码格式
# print(r.content)    #查看正确的编码格式 charset=....
# r.encoding = 'utf-8'  #修改编码格式属性
# print(r.text)


# conn = http.client.HTTPConnection('localhost')
# conn.request('GET', '/agileone/index.php')
# content = conn.getresponse().read()
# print(content.decode())

url = 'https://api.openweathermap.org/data/2.5/forecast?q=Beijing,cn&appid=800f49846586c3ba6e7052cfc89af16c'
r = requests.get(url)
resp = r.json()
print(resp)
print(resp['city']['name'], resp['list'][0]['weather'][0]['description'], resp['list'][0]['dt_txt'])
